#ifndef CONTACTS_H
#define CONTACTS_H

#include <QWidget>
#include <QVBoxLayout>
#include "friendlistbutton.h"
#include "userinfo.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Contacts; }
QT_END_NAMESPACE

class Contacts : public QWidget
{
    Q_OBJECT
public:
    Contacts(QWidget *parent = nullptr);
    void drawLeftScrollFriendList(responseGroupList* data);//更新好友列表
    /**
     * @brief 设置当前选中的用户
     * @param userinfo
     */
    void setCurrentClickedItem(ItemButton* item);
    ItemButton* getCurrentClickedItem();

    /**
     * @brief contacts页面的item点击事件
     */
    void clickItemButtonEventForContactsPage(ItemButton* item);

private:
    void styleSelf();
    /**
     * @brief 画查找好友label
     */
    void drawLeftFindFriends();
    void drawLeftScrollDeviceLabel();
    void drawLeftScrollDeviceList();
    void drawLeftScrollFriendLabel();
    void drawRightUserInfo();
    void paintEvent(QPaintEvent *event);//画线
    bool eventFilter(QObject* obj, QEvent* event);

private:
    Ui::Contacts *ui;
    int leftScrollHeight = 0;
    QVBoxLayout *scrollLayout = new QVBoxLayout;
    QVector<FriendListButton*> leftScrollFriendListButtonList;
    UserInfo *rightInfo;
    ItemButton* currentClickedItem = nullptr;//当前选中的item
    QLabel* findFriendLabel = nullptr;//查找好友
};

#endif // CONTACTS_H
